package com.chwn.curiousdiary.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.chwn.curiousdiary.R;
import com.chwn.curiousdiary.bean.HotSearchBean;
import com.chwn.harulib.widget.tag.FlowLayout;
import com.chwn.harulib.widget.tag.TagAdapter;

import java.util.List;

/**
 * Created by Myshikin on 2017/8/9.
 */

public class HotSearchAdapter extends TagAdapter<HotSearchBean> {

    private LayoutInflater mInflater;

    public HotSearchAdapter(List<HotSearchBean> datas, Context context) {
        super(datas);
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public View getView(FlowLayout parent, int position, HotSearchBean hotSearchBean) {
        TextView tv = (TextView) mInflater.inflate(R.layout.item_hot_search,
                parent, false);
        tv.setBackgroundResource(R.drawable.shape_hot_search_check);
        tv.setTextColor(Color.parseColor("#ffffff"));

        tv.setText(hotSearchBean.getKey_name());
        return tv;
    }
}
